# Contributor: lauren n. liberda <lauren@selfisekai.rocks>
maintainer="lauren n. liberda <lauren@selfisekai.rocks>"
pkgname=dart-sass
pkgver=1.80.5
pkgrel=0
pkgdesc="The primary implementation of Sass"
url="https://sass-lang.com/dart-sass"
# armv7: no buf
arch="aarch64 x86_64"	# dart
license="MIT"
depends="dartaotruntime"
makedepends="
	buf
	dart-sdk
	"
_protocol_ver=3.1.0
source="
	https://github.com/sass/dart-sass/archive/refs/tags/$pkgver/dart-sass-$pkgver.tar.gz
	https://github.com/sass/sass/archive/refs/tags/embedded-protocol-$_protocol_ver.tar.gz
	sass

	lock.patch
	"
builddir="$srcdir/dart-sass-$pkgver/"

prepare() {
	mkdir build
	mv "$srcdir/sass-embedded-protocol-$_protocol_ver" build/language

	default_prepare

	dart pub get --enforce-lockfile
}

build() {
	UPDATE_SASS_SASS_REPO=false \
		dart run grinder protobuf
	dart compile aot-snapshot -Dversion="$pkgver" ./bin/sass.dart
}

check() {
	# sanity
	dartaotruntime ./bin/sass.aot --version
}

package() {
	install -Dm644 ./bin/sass.aot "$pkgdir"/usr/lib/dart-sass/sass.aot
	install -Dm755 "$srcdir"/sass "$pkgdir"/usr/bin/sass
}

sha512sums="
df5cf2a0bc7e3ad75954a67a8ac8d623e411c697ce0a6381a6340d5360e4f04a05bf55c090d51b4e1c919aa19943b691f9643ec270076f4b4eaef8527450d65b  dart-sass-1.80.5.tar.gz
6034eafbbb61f0f4154d54213c3365602fb427bb62f19b651b9b0c371421e7f48f587da6ebc7d99426c467f9c16b2adcdc76ed453215e056a150bc086e50f5c6  embedded-protocol-3.1.0.tar.gz
e974b32f3ca9155868282c2259f693b49bd8c8b57772126efa6e29efedcf4acdb2b1359ae0cb5b0552dfd84daa0ae9273ebe90de7f66670a0a6abd75958cac6d  sass
31bf40147e4f49c39ffc1d4446f163e60ec3174d20bc1910826ded5426de49c8d3f6238446477903a6e91af9bc4d99dba73b67d3f708041509b0c5f304a5a0d6  lock.patch
"
